#include <coroutine>
#include <queue>
class Loop {

public:
  static Loop &get() {
    static Loop loop;
    return loop;
  }
  void enqueue(std::coroutine_handle<> &&coro) {
    m_coros.push(std::move(coro));
  }
  void run() {
    while (!m_coros.empty()) {
      auto coro = std::move(m_coros.front());
      m_coros.pop();
      coro.resume();
    }
  }

private:
  std::queue<std::coroutine_handle<>> m_coros;
  Loop() = default;
};